<?php
require dirname ( __FILE__ ) . '/../lib/init.php';

$_POST = addslashes_deep ( $_POST );
//$uid = $_SESSION ["USERID"];
$userdo = $_POST ["useraction"];
$table = "kt_jd";
global $db;
if ($userdo == "JDADD") {
    $jobname = $_POST ["jobname"];
    $department = $_POST ["department"];
    $company = $_POST ["company"];
    $sex = $_POST ["sex"];
    $require_num = $_POST ["require_num"];
	$deadline = $_POST ["deadline"];
    $requirement = $_POST ["requirement"];
    $data = array (
			'jobname' => $jobname
	);
	$data ["department"] = $department;
    $data ["company"] = $company;
    $data ["sex"] = $sex;
    $data ["require_num"] =$require_num ;
    $data ["deadline"] = $deadline;
    $data ["requirement"] = $requirement;
	$db->insert ( $table, $data );
} else if ($userdo == "JDEDIT") {
    $oid = $_POST ["oid"];
    $jobname = $_POST ["jobname"];
    $department = $_POST ["department"];
    $company = $_POST ["company"];
    $sex = $_POST ["sex"];
    $require_num = $_POST ["require_num"];
    $deadline = $_POST ["deadline"];
    $requirement = $_POST ["requirement"];
    $data = array (
        'jobname' => $jobname
    );
    $data ["department"] = $department;
    $data ["company"] = $company;
    $data ["sex"] = $sex;
    $data ["require_num"] =$require_num ;
    $data ["deadline"] = $deadline;
    $data ["requirement"] = $requirement;
    $db->update ( $table, $data, $oid );
} else if ($userdo == "JDDEL") {
	$oid = $_POST ["oid"];
	$oid = array_map ( "intval", $oid );
	$where = 'oid IN (' . join ( ', ', $oid ) . ')';
	$db->delete ( $table, $where );
}

 